package kd.comt.plugin;

import java.util.EventObject;

import kd.bos.form.ShowType;
import kd.bos.form.container.Tab;
import kd.bos.form.control.events.TabSelectEvent;
import kd.bos.form.control.events.TabSelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.ListShowParameter;

public class TabSwitching extends AbstractFormPlugin implements TabSelectListener{

        //待打开的页面
        private static String KEY_FORMID = "bpgx_xc";
        private static String TITLE = "相册";

    public void registerListener (EventObject e){
        //页签控件添加监听事件
        Tab tab = this.getView().getControl("bpgx_tabap");
        tab.addTabSelectListener(this);
    }

    //重写tabSelected方法
    @Override
    public void tabSelected(TabSelectEvent arg0) {
        // TODO Auto-generated method stub
        //点击页签的key
        String subTabKey = arg0.getTabKey();
        switch(subTabKey){
            case "bpgx_tabpageap1":
            ListShowParameter list2 =new ListShowParameter();
            list2.setFormId("bos_list");
            list2.setBillFormId(KEY_FORMID);
            list2.getOpenStyle().setShowType(ShowType.InContainer);
            list2.getOpenStyle().setTargetKey("bpgx_tabpageap1");
            this.getView().showForm(list2);
        }
    }


}
